home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / tex / dvivga9.zip / DVITERM.H < prev    next >
Text File  |  1988-05-30  |  2KB  |  97 lines

  1. /* -*-C-*- dviterm.h */
  2. /*-->dviterm*/
  3. /**********************************************************************/
  4. /****************************** dviterm *******************************/
  5. /**********************************************************************/
  6.  
  7. void
  8. dviterm()            /* terminate DVI file processing */
  9. {
  10.     register INT16 k;        /* loop index */
  11.  
  12. #if    OS_VAXVMS
  13.     /* Stupid VMS fflush() raises error and loses last data block
  14.        unless it is full for a fixed-length record binary file.
  15.        Pad it here with IM_EOF characters, sigh... */
  16.     for (k = (INT16)((*plotfp)->_cnt); k > 0; --k)
  17. #if    IMPRESS
  18.         OUTC(IM_EOF);
  19. #else
  20.         OUTC('\0');
  21. #endif
  22. #endif /* OS_VAXVMS */
  23.  
  24.     if (fflush(plotfp) == EOF)
  25.     (void)fatal("dviterm(): Output error -- disk storage probably full");
  26.  
  27.     /* Close all files and free dynamically-allocated font space.  Stdin
  28.        is never closed, however, because it might be needed later for
  29.        ioctl(). */
  30.  
  31.     if ((dvifp != (FILE*)NULL) && (dvifp != stdin))
  32.         (void)fclose(dvifp);
  33.     if (plotfp != (FILE*)NULL)
  34.         (void)fclose(plotfp);
  35.  
  36.     for (k = 1; k <= (INT16)nopen; ++k)
  37.     {
  38.     if (font_files[k].font_id != (FILE *)NULL)
  39.     {
  40.  
  41. #if    VIRTUAL_FONTS
  42.         if (virt_font)
  43.             (void)virtfree(font_files[k].font_id);
  44. #endif /* VIRTUAL_FONTS */
  45.  
  46.         (void)fclose(font_files[k].font_id);
  47.         font_files[k].font_id = (FILE *)NULL;
  48.     }
  49.     }
  50.  
  51.     fontptr = hfontptr;
  52.     while (fontptr != (struct font_entry *)NULL)
  53.     {
  54.     for (k = 0; k < NPXLCHARS; ++k)
  55.         if ((fontptr->ch[k].rasters) != (UNSIGN32 *)NULL)
  56.         (void)free((char *)fontptr->ch[k].rasters);
  57.     pfontptr = fontptr;
  58.     fontptr = fontptr->next;
  59.     (void)free((char *)pfontptr);
  60.     }
  61.     if (!quiet)
  62.     {
  63.     (void)fprintf(stderr," [OK]");
  64.     NEWLINE(stderr);
  65.     }
  66.  
  67. #if    (BSD42 | OS_TOPS20)
  68.     if (spool_output)
  69.     {
  70.     register char *p;
  71.  
  72. #if    BSD42
  73.     (void)sprintf(message,"DVISPOOL %s\n",dvoname);
  74. #endif
  75.  
  76. #if    OS_TOPS20
  77.     (void)sprintf(message,"DVISPOOL: %s\n",dvoname);
  78. #endif
  79.  
  80.     for (p = message; *p; ++p)
  81.     {
  82. #if    OS_TOPS20
  83.         ac1 = 0100;        /* .priin (primary input) */
  84.         ac2 = *p;        /* next character from string */
  85.         jsys(JSsti, acs);    /* stuff it into terminal input buffer */
  86. #endif
  87.  
  88. #if    BSD42
  89.         (void)ioctl(fileno(stdin),TIOCSTI,p);
  90. #endif
  91.  
  92.     }
  93.     }
  94. #endif /* (BSD42 | OS_TOPS20) */
  95.  
  96. }
  97.